const fs = require('fs')
const http = require('http')
const path = require('path')
const request = require('request')

http.createServer((req, res) => {
    // axios({
    //     method: 'get',
    //     
    // }).then(data=>{
    //     console.log(data)
    // }).catch(err=>{
    //     console.log(err)
    // })
    const opts = {
        url: 'https://v.supermonkey.com.cn/Act-ss-mp4-hd/f0c7c03579bc4e9aaed6049e6fa6833d/SUPERMONKEY-0826.mp4'
    }
    const dir = path.join(__dirname, 'video.mp4')
    request(opts.url).pipe(fs.createWriteStream(dir)).on('close',()=>{
        console.log('下载完成')
    })
}).listen(9090, ()=>{
    console.log('server is listening')
})
